package com.project.service.imp;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.UserBean;
import com.project.mapper.IUserMapper;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImp implements IUserService {
    @Autowired
    private IUserMapper mapper;
    @Override
    public UserBean login(String user, String password) {
        UserBean userBean= mapper.login(user,password);
        return userBean;
    }

    @Override
    public PageInfo<UserBean> cutPageByItem(Integer pageNum, String name, String dept) {
        PageHelper.startPage(pageNum,3);
        PageInfo<UserBean> pg = PageInfo.of(mapper.cutPageByItem(name,dept));
        return pg;
    }
}
